package queueDemo;


import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;


public class Demo1 {
    public static void main(String[] args) {
        BlockingQueue<Integer> queue1 = new ArrayBlockingQueue<Integer>(10);
        Thread t1 = new Thread(()->{
            while(true){
                queue1.add(1);
            }

        });
        Thread t2 = new Thread(()->{
            while(true){
                try {
                    Thread.sleep(1000);
//                    queue1.remove();
                    queue1.element();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }

            }
        });
        t1.start();
        t2.start();
    }
}
